﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HeresyManager.Traits
{
    [Serializable]
    public class FitForPurpose : Trait
    {
        public override string Name
        {
            get { return "Fit For Purpose"; }
        }

        Career careere;

        public override IEnumerator<Comunication.Comunicator> Accire(Character c)
        {
            c.CareereChanged += c_CareereChanged;
            return base.Accire(c);
        }

        IEnumerator<Comunication.Comunicator> c_CareereChanged(Character c)
        {
            if (careere != null)
            {
                if (careere is Careers.Adept)
                    c.Int -= 3;
                else if (careere is Careers.Assassin)
                    c.Ag -= 3;
                else if (careere is Careers.Guardsman)
                    c.BS -= 3;
                else if (careere is Careers.Scum)
                    c.Per -= 3;
                else if (careere is Careers.TechPriest)
                    c.Wp -= 3;
            }

            careere = c.Career;

            if (careere is Careers.Adept)
                c.Int += 3;
            else if (careere is Careers.Assassin)
                c.Ag += 3;
            else if (careere is Careers.Guardsman)
                c.BS += 3;
            else if (careere is Careers.Scum)
                c.Per += 3;
            else if (careere is Careers.TechPriest)
                c.Wp += 3;
            if (false)
                yield return null;
        }

        public override void DeAccire(Character c)
        {
            c.CareereChanged -= c_CareereChanged;
            base.DeAccire(c);
        }

    }
}
